package com.swotxu.ribbonprovider.web;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Date: 2020/6/25 20:50
 * @Author: swotXu
 */
@Slf4j
@RestController
public class FirstController {
    @Value("${server.port}")
    Integer port;

    @RequestMapping(value = "/user/{userId}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
    public UserInfo findUser(@PathVariable("userId") Integer userId){
        log.info("进入【findUser】 - 端口: {}", port);
        UserInfo userInfo = new UserInfo(userId, "swotxu", 18, String.valueOf(port));
        return userInfo;
    }
}
